﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;

namespace VNet.VisiSuite.Common.Production
{
    public class BaseModel : INotifyPropertyChanged
    {
        public event PropertyChangedEventHandler PropertyChanged;
        protected virtual void OnPropertyChanged(string propertyName)
        {
            if (PropertyChanged != null)
                PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
        }
    }

    public class ProductionUtils
    {
        static public string formatHour(int hour, string template)
        {
            string fmt = string.Empty;
            if (hour == 0 || hour == 24)
                fmt = "12 AM";
            else if (hour < 12)
                fmt = hour.ToString(template) + " AM";
            else if (hour == 12)
                fmt = "12 PM";
            else if (hour < 24)
                fmt = (hour - 12).ToString(template) + " PM";
            return fmt;
        }

        static public string axisLabel(DateTime ss, DateTime ee)
        {
            return formatHour(ss.Hour, "00") + "-" + formatHour(ee.Hour, "00") + " ";
        }

    }
}
